import { useState } from "react";

import { makeFacade, RoomFacade } from "@/facade/roomFacade";
import { useObservable } from '@/utils/rxHelpers';

type RoomHookTuple = [
  RoomFacade,
  boolean,
];

//需要在页面用到的变量都在这里hook，主要用于简化页面调用逻辑和代码
export function useRoomFacade(): RoomHookTuple {
  const [roomFacade] = useState(() => makeFacade());
  const [forceSignIn] = useObservable(roomFacade.forceSignIn$, false);
  return [
    roomFacade,
    forceSignIn,
  ];
}
